package com.fr.report.script.function;

import com.fr.base.core.DateUtils;
import com.fr.report.script.Function;
import com.fr.report.script.Function.Type;
import com.fr.report.script.NormalFunction;
import com.fr.report.script.Primitive;
import java.util.Date;
import java.util.GregorianCalendar;

public class MINUTE extends NormalFunction
{
  public Object run(Object[] paramArrayOfObject)
  {
    if (paramArrayOfObject.length < 1)
      return Primitive.ERROR_NAME;
    Date localDate = DateUtils.object2Date(paramArrayOfObject[0], false);
    GregorianCalendar localGregorianCalendar = new GregorianCalendar();
    localGregorianCalendar.setTime(localDate);
    return new Integer(localGregorianCalendar.get(12));
  }

  public Function.Type getType()
  {
    return Function.DATETIME;
  }

  public String getCN()
  {
    return "MINUTE(serial_number):返回某一指定时间的分钟数，其值是介于0与59之间的一个整数。\nserial_number:包含所求分钟数的时间。\n示例:\nMINUTE(\"15:36:25\")等于36。\nMINUTE(\"15:36:25\", \"HH:mm:ss\")等于36。";
  }

  public String getEN()
  {
    return "MINUTE(serial_number): Returns the minutes of a time value. The minute is given as an integer, ranging from 0 to 59.\nserial_number is the time that contains the minute you want to find. \n\nExample:\n   MINUTE(\"15:36:25\") = 36\n   MINUTE(\"15:36:25\", \"HH:mm:ss\") = 36";
  }
}